<?php

/*
 * This file is part of the FOSUserBundle package.
 *
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Vietland\AdsBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;

class PostFormType extends AbstractType {

    private $translator;

    public function setTranslator($translator) {
        $this->translator = $translator;
    }

    public function buildForm(FormBuilder $builder, array $options) {
        $unit = array('1' => 'Pixel', '0' => 'Percent');
        $builder->add('titlePost', 'text', array(
                    'required' => true,
                    'label' => $this->translator->trans('vietland.title')
                ))->add('adress', 'text', array(
                    'required' => true,
                    'label' => $this->translator->trans('vietland.address')
                ))->add('content', 'textarea', array(
                    'required' => true,
                    'label' => $this->translator->trans('vietland.content')
                ))->add('images', 'file', array('required' => false))
                ->add('category', 'choice', array(
                    'choices' => array('---' => '---Chọn chợ---'),
                    'required' => true,
                ))
        ;
    }

    public function getDefaultOptions(array $options) {
        return array(
            'data_class' => 'Vietland\AdsBundle\Document\Post'
        );
    }

    public function getName() {
        return 'vietland_ads_post';
    }

}
